/*_________________________________________封装添加航节的字符串函数___________________________________________________________*/
function getAddFlightNode(){
	var No = $(".nodeMessDetail").length+1
	var str = "";
	str+="<div class='nodeMessDetail f868686'>"+
			"<div class=floor>"+No+"</div>"+
			"<div class=floor>"+
				"<p class=midTop>出发<input readonly class='dep' type=text placeholder=机场 /><span style='color:red;font-size: 16px;'>*</span>"+
					" <input readonly class='terminal depTerminal' type='text' placeholder=航站楼 />"+
					" 时间<input readonly class='depTime datespicker' type='text'/><span style='color:red;font-size: 16px;margin-right:20px;'>*</span>"+
					" 日期变更   <input readonly class=depDc>"+						     	
					"<span style='color:red;font-size: 16px;'>*</span>"+
				"</p>"+
				"<p class='midTop'>到达<input readonly class='arr' type='text' placeholder=机场 /><span style='color:red;font-size: 16px;'>*</span>"+
					" <input readonly class='terminal arrTerminal' type='text' placeholder=航站楼 />"+
					" 时间<input readonly class='arrTime datespicker' type='text'/><span style='color:red;font-size: 16px;margin-right:20px;'>*</span>"+
					" 日期变更   <input readonly class=arrDc>"+						     	
					"<span style='color:red;font-size: 16px;'>*</span>"+
				"</p>"+
			"</div>"+
			"<div class='floor'><span><span style='display:none' class='spanId'></span></span></div>"+
		 	"<div class='floor'><span class='delete'>删除</span><span class='adjustNode'></span></div>"+
		 "</div>"		 
	$(".nodeMess").append(str)
}
//___________________________________________________________________________机场联想
var autocompleteData=[];
$.ajax({
	type:"get",
	url:"../Airapt?pageSize=100000&pageNum=1&temp="+Math.random(),
	dataType:"json",
	success:function(data){	
		autocompleteData = data.data.list; 
		$('.autocomplete').autocomplete({
		    lookup: autocompleteData,
		    autoSelectFirst:true,
		    onSelect: function (suggestion) {		   
		    }
		});
	}
})

//___________________________________________________________________________机型联想		
		var aircftAutocompleteData=[];
		$.ajax({
			type:"get",
			url:"../Aircft?pageSize=100000&pageNum=1&temp="+Math.random(),
			dataType:"json",
			success:function(data){	
				aircftAutocompleteData = data.data.list; 
				$('.aDjustVal3').autocomplete({
				    lookup: aircftAutocompleteData,
				    autoSelectFirst:true,
				    onSelect: function (suggestion) {		   
				    }
				});
			}
		})
//_____________________________________________________________________添加班期调整
		$(".scheduleAdjust").click(function(){
			scheduleAdjust()
		})
//_____________________________________________________________________添加班期调整删除
		$(".basicDetail").delegate(".del","click",function(){
			$(this).parent().parent().find(".scheStatus").text("已取消");
			$(this).css("color","#333");
		})
//_____________________________________________________________________添加班期调整str
		function scheduleAdjust(){
			var str = "";
			str+="<div class=sDjust>" +
					"<div class=sDjust_top>" +
						"<div>" +
							"<span>类型" +
								"<select class=AM>" +
									"<option value=A>增班</option>" +
									"<option value=M>减班</option>" +
								"</select>" +
							"</span>" +
							"<span class=postId style=display:none;></span>" +
							"<span>状态</span>" +
							"<span class=scheStatus>未开始</span>" +
							"<span>开始日期</span>" +
							"<input class='datespicker sDjustSD' type=text onclick=WdatePicker({dateFmt:'yyyy-MM-dd'}) />" +
							"<span>结束日期</span>" +
							"<input class='datespicker sDjustED' type=text onclick=WdatePicker({dateFmt:'yyyy-MM-dd'}) />" +
						"</div>" +
						"<div>" +
							"<span>间隔</span>" +
							"<input class=interval type=text/>" +
							"<span>备注</span>" +
							"<input class=sRemarks type=text/>" +
						"</div>" +
					"</div>" +
					"<div class=delSDjust><i class='iconfont del'>&#xe606;</i></div>" +
				 "</div>"
			$(".basicDetail").append(str);
		}
//_____________________________________________________________________添加机型调整
		$(".aircrftAdjust").click(function(){
			aircrftAdjust()
		})
//_____________________________________________________________________添加机型调整删除
		$(".airMess").delegate(".delADjust","click",function(){
			$(this).parent().parent().find("input[class=aDjustVal9]").val("已取消");
			$(this).css("color","#333");
		})
//_____________________________________________________________________添加班期调整str
		function aircrftAdjust(){
			var str = "";
			str+="<table class=aDjust>" +
					"<thead>" +
						"<tr class='f868686'>" +
							"<td>开始日期</td>" + 
							"<td>结束日期</td>" + 
							"<td>航班机型</td>" + 
							"<td>头等舱座位数</td>" + 
							"<td>商务舱座位数</td>" + 
							"<td>经济舱座位数</td>" + 
							"<td>座位总数</td>" + 
							"<td>备注</td>" + 
							"<td>状态</td>" + 
							"<td>操作</td>" + 
						"</tr>" +
					"</thead>" +
					"<tbody>" +
						"<tr>" +
							"<td style=display:none;><input class=aDjustVal0 type=text/></td>" +
							"<td><input class='aDjustVal1 datespicker' type=text onclick=WdatePicker({dateFmt:'yyyy-MM-dd'})  type=text/></td>" +
							"<td><input class='aDjustVal2 datespicker' type=text onclick=WdatePicker({dateFmt:'yyyy-MM-dd'})  type=text/></td>" +
							"<td><input class='aDjustVal3' type=text/></td>" +
							"<td><input class=aDjustVal4 type=text/></td>" +
							"<td><input class=aDjustVal5 type=text/></td>" +
							"<td><input class=aDjustVal6 type=text/></td>" +
							"<td><input class=aDjustVal7 type=text readonly/></td>" +
							"<td><input class=aDjustVal8 type=text/></td>" +
							"<td><input class='aDjustVal9' type=text readonly value=未开始></td>" +
							"<td class=aDjustDel><i class='iconfont delADjust'>&#xe606;</i></td>" +
						"</tr>" +
					"</tbody>" +
				 "</table>"
				$(".airMess").append(str);
				$('.aDjustVal3').autocomplete({
				    lookup: aircftAutocompleteData,
				    autoSelectFirst:true,
				    onSelect: function (suggestion) {		   
				    }
				});
		}
//_____________________________________________________________________添加航节调整
		$(".nodeAdjust").click(function(){
			nodeAdjust()
		})
//_____________________________________________________________________添加航节调整删除
		$(".nodeMess").delegate(".delNodeAdjust","click",function(){
			$(this).css("color","#333");
			$(this).parent().parent().find(".nDjustStatus").text("已取消");
		})
//_____________________________________________________________________添加航节调整str
		function nodeAdjust(){
			var str = "";
			str+="<div class=nDjust>" +	
					"<div>"+xuhao()+"</div>" +
					"<div>" +
						"<span>开始日期" +
							"<input class='datespicker nDjustSD' onclick=WdatePicker({dateFmt:'yyyy-MM-dd'}) type=text/>" +
						"</span></br>" +
						"<span>结束日期" +
							"<input class='datespicker nDjustED' onclick=WdatePicker({dateFmt:'yyyy-MM-dd'}) type=text/>" +
						"</span>" +
					"</div>" +
					"<div>" +
						"<span>" +
							"<input class=nDjustID style=display:none; type=text> " +
							"出发<input uppercase class='autocomplete nDjustDA' type=text> " +
							"时间<input class='datespicker nDjustST' onfocus=WdatePicker({dateFmt:'HH:mm'}) type=text/><i style=color:red;>*</i>" +							
						"</span></br>" +
						"<span>" +
							"到达<input uppercase class='autocomplete nDjustAA' type=text> " +
							"时间<input class='datespicker nDjustET' onfocus=WdatePicker({dateFmt:'HH:mm'}) type=text/><i style=color:red;>*</i>" +							
						"</span>" +
					"</div>" +
					"<div>" +
						"<textarea class=nDjustRemark></textarea>" +
					"</div>" +
					"<div class='nDjustStatus f262929'>未开始</div>" +
					"<div><span class='iconfont delNodeAdjust'>&#xe606;</span></div>" +
				 "</div>"
			$(".nodeMess").append(str);
			$('.autocomplete').autocomplete({
			    lookup: autocompleteData,
			    autoSelectFirst:true,
			    onSelect: function (suggestion) {		   
			    }
			});
		}
//计算序号
		function xuhao(){
			var length = $(".nDjust").length;
			return length+1;
		}
		
/*_________________________________________添加航节————————————————————————————————————————————————————*/

$(".add").click(function(){
	getAddFlightNode()
})

/*_________________________________________________________________________删除功能*/
$('.nodeMess').delegate(".delete","click",function(){
	var index = $(this).parent().parent().index()
	if($(".nodeMessDetail").length>1){
		$(".nodeMessDetail").eq(index).remove()
	}	
})
/*_________________________________________________________________________自动计算*/
	
	$(".airMess").delegate(".aDjustVal4","keyup",function(){
		var f = $(this).val()-0;
		var c = $(this).parent().parent().find("input[class=aDjustVal5]").val();
		var y = $(this).parent().parent().find("input[class=aDjustVal6]").val();		
		$(this).parent().parent().find("input[class=aDjustVal7]").val((f-0)+(c-0)+(y-0));
	})
	$(".airMess").delegate(".aDjustVal5","keyup",function(){
		var f = $(this).val()-0;
		var c = $(this).parent().parent().find("input[class=aDjustVal4]").val();
		var y = $(this).parent().parent().find("input[class=aDjustVal6]").val();		
		$(this).parent().parent().find("input[class=aDjustVal7]").val((f-0)+(c-0)+(y-0));
	})
	$(".airMess").delegate(".aDjustVal6","keyup",function(){
		var f = $(this).val()-0;
		var c = $(this).parent().parent().find("input[class=aDjustVal4]").val();
		var y = $(this).parent().parent().find("input[class=aDjustVal5]").val();		
		$(this).parent().parent().find("input[class=aDjustVal7]").val((f-0)+(c-0)+(y-0));
	})
	
/*________________________________________________________________________确认按钮————————*/
$(".sureButton").click(function(){
	var message = {};
	message.airlineCode = $(".airlineCode").val();
	message.pm = $(".pm").val();
	message.status = "U";
	message.startDate = $(".startDate").val();
	message.endDate = $(".endDate").val();
	message.aircraft = $(".aircraft").val();
	message.fseat = $(".fseat").val();
	message.cseat = $(".cseat").val();
	message.yseat = $(".yseat").val();
	message.id = $(".signId").text();
	message.schIndctor = $("input[type='radio']:checked").val();
	message.remarks = $(".remarks").val();
	message.infantLimit = $(".infantLimit").val();
	message.skStatus = $(".skStatus").val();
	message.cabinSeq = $(".cabinRankVal").val();
	if(message.schIndctor=="S"){
		message.schedule = $(".sche1").val();
	}
	if(message.schIndctor=="I"){
		message.intval = $(".sche2").val();
	}
/*	message.fluggage = $(".fbag").val();
	message.cluggage = $(".cbag").val();
	message.yluggage = $(".ybag").val();*/
	message.legs = [];
	/*	以下为文本输入框做验证提示（不能为空）--begin--*/
	
	//1、开始日期不能为空
	if($(".startDate").val()==""||$(".startDate").val()==undefined||$(".startDate").val()==null){
		layer.msg("开始日期不能为空",{icon: 2,time:1000})
		return false; 
		
	}
	//2、结束日期不能为空
	if($(".endDate").val()==""||$(".endDate").val()==undefined||$(".endDate").val()==null){
		layer.msg("结束日期不能为空",{icon: 2,time:1000})
		return false; 
	}
	//3、班期不能为空
	if($(".chooseSchedule").is(":checked")){
		if($(".sche1").val()==""){
			layer.msg("班期不能为空",{icon: 2,time:1000})
			return false;
		}else if(!/^[1-7]+$/.test($(".sche1").val())){
			layer.msg("班期必须为1-7之间的数字",{icon: 2,time:1000})
			return false;
		}
	}
	//隔天输入不能为空
	if($(".chooseIntval").is(":checked")){
		if($(".sche2").val()==""){
			layer.msg("隔天不能为空",{icon: 2,time:1000})
			return false;
		}else if(!/^[1-7]$/.test($(".sche2").val())){
			layer.msg("隔天必须为1-7之间的数字",{icon: 2,time:1000})
			return false;
		}
	}
	
	//4、航班机型不能为空
	if($(".aircraft").val()==""||$(".aircraft").val()==undefined||$(".aircraft").val()==null){
		layer.msg("航班机型不能为空",{icon: 2,time:1000})
		return false; 
	}
	
	if($(".fseat").val()==""||$(".fseat").val()==undefined||$(".fseat").val()==null){
		layer.msg("头等舱座位数不能为空",{icon: 2,time:1000})
		return false; 
	}else if(!/^[0-9]{1,3}$/.test($(".fseat").val())){
		layer.msg("头等舱座位数必须为不超过3位的数字",{icon: 2,time:1000})
		return false; 
	}
	
	if($(".cseat").val()==""||$(".cseat").val()==undefined||$(".cseat").val()==null){
		layer.msg("商务舱座位数不能为空",{icon: 2,time:1000})
		return false; 
	}else if(!/^[0-9]{1,3}$/.test($(".cseat").val())){
		layer.msg("商务舱座位数必须为不超过3位的数字",{icon: 2,time:1000})
		return false; 
	}
	
	if($(".yseat").val()==""||$(".yseat").val()==undefined||$(".yseat").val()==null){
		layer.msg("经济舱座位数不能为空",{icon: 2,time:1000})
		return false; 
	}else if(!/^[0-9]{1,3}$/.test($(".yseat").val())){
		layer.msg("经济舱座位数必须为不超过3位的数字",{icon: 2,time:1000})
		return false; 
	}
	
	var len_dep=$(".dep").length;
	for(var i=0;i<len_dep;i++){
		//5、出发机场不能为空
		if($(".dep")[i].value==""||$(".dep")[i].value==undefined||$(".dep")[i].value==null){
			layer.msg("出发机场不能为空",{icon: 2,time:1000})
			return false; 
		}
		//6、到达机场不能为空
		if($(".arr")[i].value==""||$(".arr")[i].value==undefined||$(".arr")[i].value==null){
			layer.msg("到达机场不能为空",{icon: 2,time:1000})
			return false; 
		}
		//7、出发航站楼若不为空则不超过5位
		if($(".depTerminal")[i].value!=""){
			 if(!/^[0-9a-zA-Z]{1,5}$/.test($(".depTerminal")[i].value)){
					layer.msg("出发航站楼的长度不能超过5位",{icon: 2,time:1000})
					return false; 
				}
		}
		//8、到达航站楼若不为空则不超过5位
		if($(".arrTerminal")[i].value!=""){
			 if(!/^[0-9a-zA-Z]{1,5}$/.test($(".arrTerminal")[i].value)){
					layer.msg("到达航站楼的长度不能超过5位",{icon: 2,time:1000})
					return false; 
				}
		}
		//9、出发时间不能为空
		if($(".depTime")[i].value==""||$(".depTime")[i].value==undefined||$(".depTime")[i].value==null){
			layer.msg("出发时间不能为空",{icon: 2,time:1000})
			return false; 
		}
		//10、到达时间不能为空
		if($(".arrTime")[i].value==""||$(".arrTime")[i].value==undefined||$(".arrTime")[i].value==null){
			layer.msg("到达时间不能为空",{icon: 2,time:1000})
			return false; 
		}
	
		//11 承运航班验证若不为空则不超过7位
		/*if($(".OC")[i].value!=""){
			 if(!/^[0-9a-zA-Z]{1,7}$/.test($(".OC")[i].value)){
					layer.msg("承运航班的长度不能超过7位",{icon: 2,time:1000})
					return false; 
				}
		}*/
		
	}
	
	
	/*----文本输入框做验证提示（不能为空）--end--*/
	var length = $(".nodeMessDetail").length;
	for(var i=0;i<length;i++){
		var json={};
		if(/\((.)+?\)/.test($(".dep").eq(i).val())){//获取出发机场三字码
			json.dep = $(".dep").eq(i).val().slice(-5).split("(")[1].split(")")[0];
		}else{
			json.dep = ($(".dep").eq(i).val()).toUpperCase();
		}
		if(/\((.)+?\)/.test($(".arr").eq(i).val())){//获取到达机场三字码
			json.arr = $(".arr").eq(i).val().slice(-5).split("(")[1].split(")")[0];
		}else{
			json.arr = ($(".arr").eq(i).val()).toUpperCase();
		}
		//json.dep = $(".dep").eq(i).val()
		//json.arr = $(".arr").eq(i).val()
		json.depTerminal = $(".depTerminal").eq(i).val()
		json.arrTerminal = $(".arrTerminal").eq(i).val()
		json.depTime = $(".depTime").eq(i).val()
		json.depDc = $(".depDc").eq(i).val()
		json.arrTime = $(".arrTime").eq(i).val()
		json.arrDc = $(".arrDc").eq(i).val()
		//json.OC = $(".OC").eq(i).val()
		json.id = $(".spanId").eq(i).text()
		message.legs.push(json)
	}
	//获得班期调整的数据
	getChgeVosData ()
	function getChgeVosData (){
		message.chgeVos = [];
		var chgeVosLength = $(".sDjust").length;
		for(var i=0;i<chgeVosLength;i++){
			var json = {};			
			json.id = $(".postId").eq(i).text();
			json.schFltId = schFltId;
			json.type = $(".AM").eq(i).val();
			json.startDate = $(".sDjustSD").eq(i).val();
			json.endDate = $(".sDjustED").eq(i).val();
			json.intval = $(".interval").eq(i).val();
			json.remark = $(".sRemarks").eq(i).val();
			json.status = commomFun.strToFlightStatus($(".scheStatus").eq(i).text());
			message.chgeVos.push(json)
		}
		return message.chgeVos;
	}
	//获得机型调整的数据
	getcrftVosData ()
	function getcrftVosData (){
		message.crftVos = [];
		var crftVosLength = $(".aDjust").length;
		for(var i=0;i<crftVosLength;i++){
			var json = {};
			json.id = $(".aDjustVal0").eq(i).val();
			json.schFltId = schFltId;
			json.startDate = $(".aDjustVal1").eq(i).val();
			json.endDate = $(".aDjustVal2").eq(i).val();
			json.aircrftName = $(".aDjustVal3").eq(i).val();
			json.fseat = $(".aDjustVal4").eq(i).val();
			json.cseat = $(".aDjustVal5").eq(i).val();
			json.yseat = $(".aDjustVal6").eq(i).val();
			json.remark = $(".aDjustVal8").eq(i).val();
			json.status = commomFun.strToFlightStatus($(".aDjustVal9").eq(i).val());	
			message.crftVos.push(json)
		}
		return message.crftVos;
	}
	//获得航节调整的数据
	gettimeVosData ()
	function gettimeVosData (){
		message.timeVos = [];
		var timeVosLength = $(".nDjust").length;
		for(var i=0;i<timeVosLength;i++){
			var json = {};
			var dep = $(".nDjustDA").eq(i).val();
			var arr = $(".nDjustAA").eq(i).val();
			if(/\((.)+?\)/.test(dep)){//获取出发机场三字码
				json.dep = dep.slice(-5).split("(")[1].split(")")[0];
			}else{
				json.dep = dep;
			}
			if(/\((.)+?\)/.test(arr)){//获取到达机场三字码
				json.arr = arr.slice(-5).split("(")[1].split(")")[0];
			}else{
				json.arr = arr;
			}									
			json.id = $(".nDjustID").eq(i).val();
			json.schFltId = schFltId;
			json.startDate = $(".nDjustSD").eq(i).val();
			json.endDate = $(".nDjustED").eq(i).val();			
			json.depTime = $(".nDjustST").eq(i).val();
			json.arrTime = $(".nDjustET").eq(i).val();
			json.remark = $(".nDjustRemark").eq(i).val();			
			json.status = commomFun.strToFlightStatus($(".nDjustStatus").eq(i).text());	
			message.timeVos.push(json)
		}
		return message.timeVos;
	}
	console.log(message)
	
	layer.msg('修改中...', {icon: 16,shade: 0.01});	
	$.ajax({
		type:"post",
		url:"../flightSchedule/api/update?temp="+Math.random(),
		contentType:'application/json;charset=utf-8',
		data:JSON.stringify(message),
		async:true,
		success:function(data){
			data = JSON.parse(data)
			if(data.status=='1001'){
				layer.msg('修改成功', {icon: 1,time:1000},function(){
					var index = parent.layer.getFrameIndex(window.name);//获取弹窗索引
					parent.layer.close(index);//关闭弹窗
				});
			}else{
				//layer.msg('修改失败', {icon: 2});
				layer.confirm(data.message, {
					title:['修改失败','background-color:#00aa98;color:#fff'],
				   	btn: ['确定'] //按钮
				}, function(){
					layer.closeAll('dialog');
				});
			}
				
			
			
		}
	});
	
})
/*____________________________________________修改计划页面渲染______________________________________________*/	
  	var schFltId=getHref().schFltId;
	$.ajax({
		type:"get",
		url:"../flightSchedule/api/flightDetail?schFltId="+schFltId+"&temp="+Math.random(),
		success:function(data){
			data = JSON.parse(data)			
			$(".airlineCode").val(data.data.airlineCode)
			$(".pm").val(data.data.pm)
			if(data.data.status=="O"){	
				data.data.status="执行中";
			}	
			if(data.data.status=="U"){				
				data.data.status="未开始"
			}
			if(data.data.status=="D"){				
				data.data.status="已完成"				
			}
			if(data.data.status=="C"){				
				data.data.status="已取消"				
			}
			$(".status").val(data.data.status)
			$(".startDate").val(data.data.startDate)
			$(".endDate").val( data.data.endDate)
			$(".aircraft").val( data.data.aircraft)
			$(".cseat").val(data.data.cseat)
			$(".fseat").val(data.data.fseat)
			$(".yseat").val(data.data.yseat)
			$(".cabinRankVal").val(data.data.cabinSeq);
			if(data.data.schIndctor=="S"){
				$(".chooseSchedule").prop("checked","checked")
				$(".sche1").val(data.data.schedule);
				$(".sche1").prop("disabled",true)
				$(".sche2").val("");
				$(".sche2").prop("disabled",true);
				$(".chooseIntval").prop("disabled","true")				
			}
			if(data.data.schIndctor=="I"){
				$(".chooseIntval").prop("checked","checked")
				$(".sche2").val(data.data.intval);
				$(".sche2").prop("disabled",true);
				$(".sche1").val("");
				$(".sche1").prop("disabled",true);
				$(".chooseSchedule").prop("disabled","true")
			}
			/*$(".cbag").val(data.data.cluggage);
			$(".fbag").val(data.data.fluggage);
			$(".ybag").val(data.data.yluggage);*/
			var totalseat = (data.data.cseat-0) + (data.data.fseat-0)  + (data.data.yseat-0)
			$(".totalseat").val(totalseat);
			$(".signId").text(data.data.id);
			$(".skStatus").val(data.data.skStatus);
			$(".remarks").val(data.data.remarks);
			$(".infantLimit").val(data.data.infantLimit);
			for(var i=0;i<data.data.legs.length;i++){
				getAddFlightNode()
				$(".dep").eq(i).val(data.data.legs[i].dep)
				$(".arr").eq(i).val(data.data.legs[i].arr)
				$(".depTerminal").eq(i).val(data.data.legs[i].depTerminal)
				$(".arrTerminal").eq(i).val(data.data.legs[i].arrTerminal)
				$(".depTime").eq(i).val(data.data.legs[i].depTime)
				$(".arrTime").eq(i).val(data.data.legs[i].arrTime)
				$(".depDc").eq(i).val(data.data.legs[i].depDc)
				$(".arrDc").eq(i).val(data.data.legs[i].arrDc)
				//$(".OC").eq(i).val(data.data.legs[i].oC)	
				$(".spanId").text(data.data.legs[i].id)
			}
			//航班调整部分数据展示
			if(data.data.chgeVos){
				var chgeVos = data.data.chgeVos;
				for(var i=0;i<chgeVos.length;i++){
					if(chgeVos[i].status=="U"){                         //未开始的可以修改
						scheduleAdjust()
						$(".postId").eq(i).text(chgeVos[i].id);
						$(".AM").eq(i).val(chgeVos[i].type);
						$(".sDjustSD").eq(i).val(chgeVos[i].startDate);
						$(".sDjustED").eq(i).val(chgeVos[i].endDate);
						$(".interval").eq(i).val(chgeVos[i].intval);
						$(".sRemarks").eq(i).val(chgeVos[i].remark);
						$(".scheStatus").eq(i).text(commomFun.flightStatusToStr(chgeVos[i].status));
					}else{                                              //其他状态不可修改
						var str = "";
						str+="<div class=sDjust>" +
								"<div class=sDjust_top>" +
									"<div>" +
										"<span>类型" +
											"<select disabled class=AM>" +
												"<option value="+chgeVos[i].type+">"+commomFun.amTo(chgeVos[i].type)+"</option>" +												
											"</select>" +											
										"</span>" +
										"<span class=postId style=display:none;>"+chgeVos[i].id+"</span>" +
										"<span>状态</span>" +
										"<span class=scheStatus>"+commomFun.flightStatusToStr(chgeVos[i].status)+"</span>" +
										"<span>开始日期</span>" +
										"<input readonly class='datespicker sDjustSD' value="+chgeVos[i].startDate+">" +
										"<span>结束日期</span>" +
										"<input readonly class='datespicker sDjustED' value="+chgeVos[i].endDate+">" +
									"</div>" +
									"<div>" +
										"<span>间隔</span>" +
										"<input readonly class=interval type=text value="+chgeVos[i].intval+">" +
										"<span>备注</span>" +
										"<input readonly class=sRemarks type=text value="+chgeVos[i].remark+">" +
									"</div>" +
								"</div>" +							
							 "</div>"
						$(".basicDetail").append(str);
					}
				}
			}
			if(data.data.crftVos){
				//机型调整部分数据展示
				var crftVos = data.data.crftVos;
				for(var i=0;i<crftVos.length;i++){
					 aircrftAdjust();
					 $(".aDjustVal0").eq(i).val(crftVos[i].id);
					 $(".aDjustVal1").eq(i).val(crftVos[i].startDate);
					 $(".aDjustVal2").eq(i).val(crftVos[i].endDate);
					 $(".aDjustVal3").eq(i).val(crftVos[i].aircrftName);
					 $(".aDjustVal4").eq(i).val(crftVos[i].fseat);
					 $(".aDjustVal5").eq(i).val(crftVos[i].cseat);
					 $(".aDjustVal6").eq(i).val(crftVos[i].yseat);
					 $(".aDjustVal7").eq(i).val(crftVos[i].fseat+crftVos[i].cseat+crftVos[i].yseat);
					 $(".aDjustVal8").eq(i).val(crftVos[i].remark);	
					 if(crftVos[i].status!="U"){
						 $(".aDjustDel").eq(i).css("color","#333");
					 }
					 $(".aDjustVal9").eq(i).val(commomFun.flightStatusToStr(crftVos[i].status));
					 $(".aDjustVal10").eq(i).val(crftVos[i].aircrftId);
				}
			}
			//航节调整部分数据展示
			if(data.data.timeVos){
				var timeVos = data.data.timeVos;
				for(var i=0;i<timeVos.length;i++){
					nodeAdjust()
					$(".nDjustID").eq(i).val(timeVos[i].id);
					$(".nDjustSD").eq(i).val(timeVos[i].startDate);
					$(".nDjustED").eq(i).val(timeVos[i].endDate);
					$(".nDjustAA").eq(i).val(timeVos[i].arr);
					$(".nDjustDA").eq(i).val(timeVos[i].dep);	
					$(".nDjustST").eq(i).val(timeVos[i].depTime);
					$(".nDjustET").eq(i).val(timeVos[i].arrTime);
					$(".nDjustRemark").eq(i).val(timeVos[i].remark);	
					 if(timeVos[i].status!="U"){
						 $(".delNodeAdjust").eq(i).css("color","#333");
					 }
					$(".nDjustStatus").eq(i).text(commomFun.flightStatusToStr(timeVos[i].status));	
				}
				
			}
		}					
	});	


/*________________________________________________________________________班期与隔天的处理————————*/
	/*$(".valide input[type=radio]").click(function(){
		if($(".chooseSchedule").is(":checked")){//班期选中
			$(".sche2").val("");
			$(".sche2").prop("disabled",true);
			$(".sche1").prop("disabled",false)
		}
		
		if($(".chooseIntval").is(":checked")){//隔天选中
			$(".sche1").val("");
			$(".sche1").prop("disabled",true);
			$(".sche2").prop("disabled",false);
			
		}
	})*/





